package com.home.action;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.home.model.Admin;

@Controller
public class AdminAction {
	@RequestMapping("/login.do")
	public String login(Admin admin,HttpSession session) {
		if (admin.getUsername() == null
				|| admin.getUsername().trim().equals("")) {
			return "/login";
		}
		if (admin.getPassword() == null
				|| admin.getPassword().trim().equals("")) {
			return "/login";
		}
		if (!admin.getUsername().equals("admin")
				|| !admin.getPassword().equalsIgnoreCase("123")) {
			return "/login";
		}
		
		session.setAttribute("admin", admin);
		return "/admin/temp/index";
	}

}
